package com.ys.web.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ys.web.dao.CommonDao;
import com.ys.web.entity.Originality;
import com.ys.web.service.OriginalityService;

@Service
@Transactional
public class OriginalityServiceImpl implements OriginalityService {

	@Autowired
	private CommonDao commonDao;

	@Override
	public void saveOrUpdate(Originality originality) {
		Originality originality2 = new Originality();
		originality2.setAccount(originality.getAccount());
		originality2.setPromotionDate(originality.getPromotionDate());
		originality2.setPromotionPlan(originality.getPromotionPlan());
		originality2.setPromotionUnit(originality.getPromotionUnit());
		originality2.setOriginalityTitle(originality.getOriginalityTitle());
		originality2.setOriginalityDescribeOne(originality.getOriginalityDescribeOne());
		List<Originality> existOriginalities = commonDao.findByExample("com.ys.web.entity.Originality",originality2);
		if(existOriginalities!=null&&existOriginalities.size()>0){
			originality =existOriginalities.get(0);
		}
		commonDao.saveOrUpdate(originality);
	}

	@Override
	public void saveOriginalities(List<Originality> originalities) {
		// TODO Auto-generated method stub
		
	}
	
	
}
